<div class="row" ng-controller="hotBusinessListController">
    <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby=addModalLabel">
        <div class="modal-dialog" role="document">
            <form name="addform" class="form-validation form-horizontal">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="addModalLabel">增加热门商家信息</h4>
                </div>
                <div class="modal-body">
                    <!--增加-->
                    <div class="row" >
                        <div class="col-md-12">
                                <div class="form-group character-counter">
                                    <label class="control-label col-md-2">商家名称</label>

                                    <div class="col-md-10">
                                        <input type="text" class="form-control" placeholder="请输入商家名称" ng-model="hotBusiness.business" maxlength="50" required/>
                                        <label class="character-counter-label-2" ng-bind="(hotBusiness.business != undefined ? hotBusiness.business.length : 0)+' / 50'">
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group character-counter">
                                    <label  class="control-label col-md-2">地址</label>

                                    <div class="col-md-10 ">
                                        <input type="text" class="form-control" placeholder="请输入地址" ng-model="hotBusiness.address" maxlength="50" required/>
                                        <label class="character-counter-label-2" ng-bind="(hotBusiness.address != undefined ? hotBusiness.address.length : 0)+' / 50'">
                                        </label>
                                    </div>
                                </div>
                            <div class="form-group character-counter">
                                <label  class="control-label col-md-2">餐品图片URL</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" placeholder="请输入餐品图片URL" ng-model="hotBusiness.pictureUrl"  required/>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--修改-->
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary" ng-disabled="addform.$invalid" ng-click="addHotBusiness()"  data-dismiss="modal">提交</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
                </div>
            </div>
                </form>
        </div>
    </div>
    <div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel">
        <div class="modal-dialog" role="document">
            <form name="updform" class="form-validation form-horizontal">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="updateModalLabel">修改热门商家信息</h4>
                </div>
                <div class="modal-body">
                    <!--修改-->
                    <div class="row" >
                        <div class="col-md-12">
                                <div class="form-group character-counter">
                                    <label  class="control-label col-md-2">商家名称</label>

                                    <div class="col-md-10">
                                        <input type="text" class="form-control"  placeholder="请输入商家名称" ng-model="row.business" value="{{row.business}}" maxlength="50" required/>
                                        <label class="character-counter-label-2" ng-bind="(row.business != undefined ? row.business.length : 0)+' / 50'">
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group character-counter">
                                    <label  class="control-label col-md-2">地址</label>

                                    <div class="col-md-10">
                                        <input type="text" class="form-control" placeholder="请输入地址" ng-model="row.address" value="{{row.address}}" maxlength="50" required/>
                                        <label class="character-counter-label-2" ng-bind="(row.address != undefined ? row.address.length : 0)+' / 50'">
                                        </label>
                                    </div>
                                </div>
                            <div class="form-group character-counter">
                                <label  class="control-label col-md-2">餐品图片URL</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" placeholder="请输入餐品图片URL" ng-model="row.pictureUrl" value="{{row.pictureUrl}}" required/>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--修改-->
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary"  ng-click="updateHotBusiness(hotBusiness)" ng-disabled="updform.$invalid" data-dismiss="modal">提交</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
                </div>
            </div>
                </form>
        </div>
    </div>
    <div class="col-md-12">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h1 class="panel-title">
                    热门商家列表
                </h1>
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-md-12">
                <table class="table table-hover table-cell table-bordered">
                    <thead>
                    <tr>
                        <th></th>
                        <th>商家名称</th>
                        <th>地址</th>
                        <th>餐品图片URL</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="hotBusiness in hotBusinesses">
                        <td>{{$index+1}}</td>
                        <td>{{hotBusiness.business}}</td>
                        <td>{{hotBusiness.address}}</td>
                        <td>{{hotBusiness.pictureUrl}}</td>
                        <td>
                            <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#updateModal" ng-click="update(hotBusiness)">修改
                            </button>
                            <button class="btn btn-primary btn-sm" ng-click="deleteHotBusiness(hotBusiness.id,hotBusiness.name)">删除
                            </button>
                        </td>
                    </tr>
                    </tbody>
                </table>
                        </div>
                    </div>
            </div>
            <div class="panel-footer">
                <button type="button" class="btn btn-info " data-toggle="modal" data-target="#addModal" ng-click="add()">增加热门商家</button>
                <a href="#/welcomePage" class="btn btn-info">返回首页</a>
            </div>
        </div>
    </div>
    <!-- Modal -->

</div>